using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace ProtocToCSharp
{
    public static class DirectoryHelper
    {
        public static List<DirectoryInfo> GetAllDirectories(this DirectoryInfo directory)
        {
            List<DirectoryInfo> children = new List<DirectoryInfo>();

            directory.GetDirectories().ToList().ForEach(c =>
            {
                children.Add(c);
                children = children.Union(c.GetAllDirectories()).ToList();
            });

            return children;
        }
    }
}
